import { UserEntity } from '@/api/create/interface'
import { ListChildComponentProps } from 'react-window'

export interface ListTopActionItem {
	text: string
	onClick: React.MouseEventHandler
	disabled?: boolean
}

export interface TerMode {
	mcc: UserEntity
	status: {
		checked: boolean
	}
	uuid: string
}

export interface RowRendererProps extends ListChildComponentProps {
	data: Array<TerMode>
}

export interface CreateMemberProps {
	list: Array<UserEntity>
	/**更新外部的传入的List列表*/
	setOuterList: (_d: Array<UserEntity>, type: 'remove' | 'sort' | 'drop') => void
	/**标题 默认已选*/
	title?: React.ReactNode
	/**自定义的头部操作按钮 */
	topActions?: ListTopActionItem[]
	/**隐藏排序按钮操作  默认隐藏 false */
	isHideOrder?: boolean
	/**不可操作*/
	disabled?: boolean
	/**顶部*/
	top?: () => boolean
	/**向上*/
	up?: () => boolean
	/**向下*/
	down?: () => boolean
	/**底部 */
	bottom?: () => boolean
	/**当前的dom的高度*/
	height?: number
	/**额外的children*/
	children?: React.ReactNode
	width?: number
	isShowBottomTip?: boolean
}
export const ListTranslator = (source: Array<UserEntity>): TerMode[] =>
	source.map((item) => ({
		mcc: item,
		status: {
			checked: false,
		},
		uuid: `${item.account_type}$$${item.account}`,
	}))
